"use strict";
let StringDecoder = require('string_decoder').StringDecoder;
let decoder = new StringDecoder('utf8');

let euro = Buffer.from([0xE2, 0x82]);
let euro2 = Buffer.from([0xAC]);

console.log(decoder.write(euro));
console.log(decoder.write(euro2));

console.log(euro.toString());
console.log(euro2.toString());

console.log(euro.length)
console.log(euro2.length)

console.log('======================================')

let buf =new Buffer(4);

buf.writeUInt8(0x63, 0);
buf.writeUInt8(0x61, 1);
buf.writeUInt8(0x74, 2);
buf.writeUInt8(0x73, 3);

console.log(buf.toString());